import xmlrpclib
import info

def blog_post(user, passwd, blog_id, 
              blog_api_url, title, content, publish):
    server = xmlrpclib.ServerProxy(blog_api_url)
    categories = ["twitter"]
    blog_content = { 'title' : title, \
                     'description' : content, \
                     'categories' : categories }

    post_id = server.metaWeblog.newPost(blog_id, user, passwd, \
                                        blog_content, publish)
    return post_id

if __name__ == '__main__':
    print blog_post(info.blog_user, info.blog_passwd, \
                    info.blog_id, info.blog_api_url, \
                    "test", "<a href='www.naver.com'>naver</a>", 0)
